# Chained exceptions

import shutil


def mycopy(source, dest):
    try:
        shutil.copy2(source, dest)
    except OSError:  # python2 里 raise 会丢失原来的 traceback 信息
        raise NotImplementedError("automatic sudo injection") from OSError


mycopy('old', 'new')
